//
//  DateTime+Ex.swift
//  FastComponent
//
//  Created by zj on 2022/11/29.
//

import Foundation


//let now = Date.init()
//let calendar:Calendar = Calendar.current;
//
//let year = calendar.component(.year, from: now);
//
//let monthV = calendar.component(.month, from: now);
//
//let day = calendar.component(.day, from: now);
//
//let hour = calendar.component(.hour, from: now);
//
//let minute = calendar.component(.minute, from: now);
//let second = calendar.component(.second, from: now);


public extension Date{
    
    func xx_dateComponents() -> DateComponents{
        let calendar:Calendar = Calendar.current;
        
        return calendar.dateComponents(in: TimeZone.current, from: self)
    }
    
    func __xx_demo() -> (Int,Int,Int,Int,Int,Int){
        let calendar:Calendar = Calendar.current;
        
        let year = calendar.component(.year, from: self);
        
        let month = calendar.component(.month, from: self);
        
        let day = calendar.component(.day, from: self);
        
        let hour = calendar.component(.hour, from: self);
        
        let minute = calendar.component(.minute, from: self);
        let second = calendar.component(.second, from: self);
        
        return (
            year,
            month,
            day,
            hour,
            minute,
            second
        )
    }
}
